<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<p>整数1：<input type="text" id="one"></p>
<p>整数2：<input type="text" id="two"></p>

<button onclick="change('jia')">相加</button>
<button onclick="change('jian')">相减</button>
<button onclick="change('cheng')">相乘</button>
<button onclick="change('chu')">相除</button>

<p>结果：<input type="text" id="three"></p>
</body>
<script>
    function change(e){
        var text1 = document.querySelector("#one").value;
        text1 = Number(text1);
        var text2 = document.querySelector("#two").value;
        text2 = Number(text2);
        var a = 0;
        switch (e){
            case'jia':
                a =text1 + text2;
                break;
            case 'jian':
                a =text1 - text2;
                break;
            case 'cheng':
                a =text1 * text2;
                break;
            case 'chu':
                a =text1 / text2;
                break;
        }
        document.querySelector("#three").value = a;
    }
</script>
</html>